<?php

namespace app\api\controller\shop;

use app\admin\model\shop\Category;
use app\common\controller\Api;

/**
 * 商户订单创建接口
 */
class Shopordercreate extends Api
{
    protected $noNeedRight = ['*'];

    //创建订单
    public function create()
    {
        $params = input();
        try {
            $model = new \app\api\model\shop\ShopOrderCreate();
            $params['user_id'] = $this->auth->id;
            $res = $model->createOrder($params);

        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('',$res);
    }

    //订单计算信息
    public function calculate()
    {
        $params = input();
        try {
            $model = new \app\api\model\shop\ShopOrderCreate();
            $params['user_id'] = $this->auth->id;
            $res = $model->calculate($params);

        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
        $this->success('',$res);
    }


}